﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NHibernate;
using dbPoll_Application.Helpers;
using NHibernate.Linq;
using dbPoll_Application.Models;

namespace dbPoll_Application.Controllers
{
    public class DebugController : Controller
    {
        public void ClearPollStart()
        {
            ISession session = NHibernateHelper.GetCurrentSession();
            using (ITransaction transaction = session.BeginTransaction())
            {
                var polls = from item in session.Query<Poll>()
                            select item;
                foreach (var poll in polls)
                {
                    poll.pollStart = null;
                }
                transaction.Commit();
            }
        }
    }
}
